package is95powercontrol;
import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.Font;
import javafx.util.Math;



/**
 * @author Andrzej
 */

public class TextAreaMonitor extends CustomNode {

    public var mobX : Double;
    public-init  var width = 300;
    public-init var height = 200;
    public var x : Number;
    public var y : Number;
    public var wrapWidth : Number;



    public var textField = Text{
                layoutX: bind x;
                layoutY: bind y;
                font: Font {
                    name: "Times New Roman"
                    size: 20
                }

                fill: Color.WHITE
                wrappingWidth: bind wrapWidth
                content: ""
                textAlignment: TextAlignment.CENTER
    }


    override public function create () : Node {
        textField;
    }


    public function updateTextArea (translateX: Number, translateY: Number) : Void {
        var distance = Math.sqrt(Math.pow(translateX,2) + Math.pow(translateY,2));
        textField.content = "{distance}";
    }
}